package com.ddstation.onsitelaw.enumerate;

public enum YbTypeEnum {
    SHIYBTYPE(1,"市医保"),
    SHENGYBTYPE(2,"省医保");

    private final Integer code;
    private final String info;


    YbTypeEnum(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    /**
     * 根据code获取对应属性
     * @param code
     * @return
     */
    public static String getInfo(Integer code){
        for (YbTypeEnum drugTypeEnum : YbTypeEnum.values()){
            if (drugTypeEnum.getCode().equals(code)){
                return drugTypeEnum.getInfo();
            }
        }
        return null;
    }

    /**
     * 根据属性获取对应状态码
     * @param info
     * @return
     */
    public static Integer getCode(String info){
        for (YbTypeEnum drugTypeEnum : YbTypeEnum.values()){
            if (drugTypeEnum.getInfo().equals(info)){
                return drugTypeEnum.getCode();
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }
}
